#include <stdio.h>
#include <stdlib.h> /* for atoi() */
#include "do_mp.h"

int do_set_baudrate(int argc, char **argv)
{
	int baudrate;
	char *baudrate_str;

	if (argc != 2)
	{
		return 1;
	}
	else
	{
		baudrate_str = argv[1];
	}

	baudrate = atoi(baudrate_str);
	printf("set baudrate: %d\n", baudrate);
	return 0;
}

void man_set_baudrate(void)
{
	printf("Usage:\n\tsetbaudrate [new baudrate]\n");
}

int do_lock_baudrate(int argc, char **argv)
{
	if (argc == 1)
	{
		man_lock_baudrate();
	}
	else
	{
		;
	}
	return 0;
}

void man_lock_baudrate(void)
{
	printf("Usage:\n\tlockbaudrate\n");
}

int do_page_erase(int argc, char **argv)
{
	if (argc == 1)
	{
		man_page_erase();
	}
	else
	{
		;
	}
	return 0;
}

void man_page_erase(void)
{
	printf("Usage:\n\tpageerase [start addr] [size]\n");
}

int  do_chip_erase(int argc, char **argv)
{
	if (argc == 1)
	{
		man_chip_erase();
	}
	else
	{
		;
	}
	return 0;
}

void man_chip_erase(void)
{
	printf("Usage:\n\tchiperase\n");
}


int do_program(int argc, char **argv)
{
	if (argc == 1)
	{
		man_program();
	}
	else
	{
		;
	}
	return 0;
}

void man_program(void)
{
	printf("Usage:\n\tprogram [start addr] [size]\n");
}

int do_flash_read(int argc, char **argv)
{
	if (argc == 1)
	{
		man_flash_read();
	}
	else
	{
		;
	}
	return 0;
}

void man_flash_read(void)
{
	printf("Usage:\n\tflashread [start addr] [size]\n");
}

int do_block64_erase(int argc, char **argv)
{
	if (argc == 1)
		man_block64_erase();
	return 0;
}

void man_block64_erase(void)
{
	printf("Usage:\n\tbe64 [start addr] [size]\n");
}

int do_ext_block32_erase(int argc, char **argv)
{
	if (argc == 1)
		man_ext_block32_erase();
	return 0;
}

void man_ext_block32_erase(void)
{
	printf("Usage:\n\textbe32 [start addr] [size]\n");
}

int do_ext_block64_erase(int argc, char **argv)
{
	if (argc == 1)
		man_ext_block64_erase();
	return 0;
}

void man_ext_block64_erase(void)
{
	printf("Usage:\n\textbe64 [start addr] [size]\n");
}

int do_ext_sector_erase(int argc, char **argv)
{
	if (argc == 1)
		man_ext_sector_erase();
	return 0;
}

void man_ext_sector_erase(void)
{
	printf("Usage:\n\textsectorerase [start addr] [size]\n");
}

int do_ext_chip_erase(int argc, char **argv)
{
	if (argc == 1)
		man_ext_chip_erase();
	return 0;
}

void man_ext_chip_erase(void)
{
	printf("Usage:\n\textchiperase\n");
}

int do_ext_program(int argc, char **argv)
{
	if (argc == 1)
		man_ext_program();
	return 0;
}

void man_ext_program(void)
{
	printf("Usage:\n\textprogram [start addr] [size]\n");
}

int do_ext_flash_read(int argc, char **argv)
{
	if (argc == 1)
		man_ext_flash_read();
	return 0;
}

void man_ext_flash_read(void)
{
	printf("Usage:\n\textflashread [start addr] [size]\n");
}

int do_gdma_beg(int argc, char **argv)
{
	if (argc == 1)
	{
		man_gdma_beg();
	}
	else
	{
		;
	}
	return 0;
}

void man_gdma_beg(void)
{
	printf("Usage:\n\tgdmabeg [image size]\n");
}

int do_flash_verify(int argc, char **argv)
{
	if (argc == 1)
	{
		man_flash_verify();
	}
	else
	{
		;
	}
	return 0;
}

void man_flash_verify(void)
{
	printf("Usage:\n\tflashverify [start addr] [size]\n");
}

int do_ext_flash_verify(int argc, char **argv)
{
	if (argc == 1)
	{
		man_ext_flash_verify();
	}
	else
	{
		;
	}
	return 0;
}

void man_ext_flash_verify(void)
{
	printf("Usage:\n\textflashverify [start addr] [size]\n");
}

